import random
from string import Template

import urllib2
import BeautifulSoup

page = urllib2.urlopen('http://buzz.yahoo.com')
soup = BeautifulSoup.BeautifulSoup(page.read())
buzzlist = soup.find('table', id='top-searches')

tags = []
for mover in buzzlist.findAll('td'):
    if mover and mover.a:
        tags.append(mover.a.renderContents())


titles = [
'The Adventure of the  {buzz}',
'The Mysteries of a {buzz}',
'{buzz} and Other Stories ',
'Being The Tragedy Of {buzz}',
'The Disappearance of {buzz}',
'The Doings of {buzz}',
'The Exploits of {buzz}',
'The Great {buzz}',
'The Great Shadow and Other Napoleonic Tales ',
'The Hound of the {buzz}',
'The Lock and Key ',
'The Lost World ',
'The Memoirs of {buzz}',
'His Statement as made to {buzz}',
'{buzz}, The Murderer ',
'The Mystery of {buzz}',
'The Return of Sherlock Holmes at {buzz}',
'The Sign of the {buzz}',
'The Stark Munro Letters ',
'A Study in {buzz}',
'The Tragedy of the {buzz}',
'A Memory of the {buzz}',
'The War in {buzz}',
'The White {buzz}']

title = random.choice(titles)
print title.replace('{buzz}',random.choice(tags))
